package com.glela.platform.service;

import java.util.List;

import com.glela.platform.model.PromotionDetail;
import com.glela.platform.model.RedeemCode;
import com.glela.platform.model.RedeemCodeLog;
import com.glela.platform.model.UserPromotion;

/**
 * 兑换码
 * 
 * @author 卫耀华
 * @date 2016-11:04:23
 *
 */
public interface RedeemCodeService {

	/**
	 * 查询兑换码详情，根据兑换码查询
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param redeemCode
	 * @return
	 */
	public RedeemCode selectRedeemCodeByRedeemCode(String redeemCode);

	/**
	 * 根据兑换码id和用户id查询兑换日志
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param redeemCodeId
	 * @param userId
	 * @return
	 */
	public RedeemCodeLog selectRedeemCodeLogByRedeemCodeIdAndUserId(int redeemCodeId, long userId);

	/**
	 * 根据兑换码的ID查询该兑换码对应的可兑换明细
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param promotionId
	 * @return
	 */
	public List<PromotionDetail> selectPromotionDetailByPromotionId(int promotionId);

	/**
	 * 根据优惠券明细ID和用户ID查询用户持有的优惠券
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param id
	 * @param userId
	 * @return
	 */
	public UserPromotion selectUserPromotionByPromotionDetailIdAndUserId(int promotionDetailId, Long userId);

	/**
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param promotionDeatailId
	 * @param userId
	 * @param drawChannel
	 * @return
	 */
	public void insertPromotionLog(int promotionDeatailId, long userId, int drawChannel);

	/**
	 * 修改兑换码已用次数
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param id
	 * @param usedTimes
	 * @return
	 */
	public void updateRedeemCodeUsedTimesById(int id, int usedTimes);

	/**
	 * 添加兑换日志
	 * 
	 * @author 卫耀华
	 * @date 2016-10-05
	 * @param redeemCodeId
	 * @param userId
	 * @return
	 */
	public void insertRedeemCodeLog(int redeemCodeId, long userId);
}
